/*
 * @Author: 张帆 zhangfan@jxtech.net
 * @Date: 2022-06-07 19:58:49
 * @LastEditors: 张帆 zhangfan@jxtech.net
 * @LastEditTime: 2024-11-22 10:19:20
 * @FilePath: /vite-ts-vue3/src/router/index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { createRouter,createWebHistory,RouteRecordRaw } from 'vue-router';
import Layout from '../layout/index.vue'

export const constantRoutes: Array<RouteRecordRaw> = [
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: '/dashboard',
        component: () => import('@/layout/dashboard/index.vue'),
        name: 'dashboard',
        meta: {
          title: '首页',
          icon: '#icondashboard'
        }
      }
    ]
  },
  {
    path: '/demo',
    component: Layout,
    redirect: '/demo/study',
    children: [
      {
        path: '/demo/study',
        component: () => import('@/layout/demo/index.vue'),
        name: 'demo',
        meta: {
          title: '学习',
          icon: '#icondashboard'
        }
      }
    ]
  },
  {
    path: '/xiaozhi',
    component: Layout,
    redirect: '/xiaozhi/study',
    children: [
      {
        path: '/xiaozhi/study',
        component: () => import('@/views/xiaozhi/index.vue'),
        name: 'xiaozhi',
        meta: {
          title: '小智',
          icon: '#icondashboard'
        }
      }
    ]
  },
  {
    path: '/login',
    name:'login',
    component: () => import('@/views/login/login.vue'),
  },
  {
    path: '/hello',
    name:'hello',
    component: () => import('@/components/TestDialog.vue'),
  },
  {
    path: '/department/detail',
    component: Layout,
    redirect: '/department/detail/:id',
    children: [
      {
        path: '/department/detail/:id',
        component: () => import('@/views/system/department/detail.vue'),
        name: 'departmentDeatil',
        meta: {
          title: '部门详情',
          icon: '#icondashboard',
          hidden: true,
        }
      }
    ]
  }
]

// 创建路由
const router = createRouter({
  history:createWebHistory(),
  routes:constantRoutes
})

// 把路由暴露出去
export default router